package manong.mapper;

import manong.beans.Arrange;
import manong.beans.ArrangeQuery;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

@Mapper
public interface ArrangeMapper {
    
    long countByExample(ArrangeQuery example);

    int deleteByExample(ArrangeQuery example);

    @Delete({
        "delete from arrange",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into arrange (course_id, class_id, ",
        "room_id, techer_id, ",
        "seme_id, course_name, ",
        "class_name, room_name, ",
        "techer_name, star_week, ",
        "end_week, srd, statu, ",
        "mark)",
        "values (#{courseId,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER}, ",
        "#{roomId,jdbcType=INTEGER}, #{techerId,jdbcType=INTEGER}, ",
        "#{semeId,jdbcType=INTEGER}, #{courseName,jdbcType=VARCHAR}, ",
        "#{className,jdbcType=VARCHAR}, #{roomName,jdbcType=VARCHAR}, ",
        "#{techerName,jdbcType=VARCHAR}, #{starWeek,jdbcType=INTEGER}, ",
        "#{endWeek,jdbcType=INTEGER}, #{srd,jdbcType=INTEGER}, #{statu,jdbcType=INTEGER}, ",
        "#{mark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Arrange record);

  
    int insertSelective(Arrange record);

  
    List<Arrange> selectByExampleWithRowbounds(ArrangeQuery example, RowBounds rowBounds);

   
    Arrange selectOneByExample(ArrangeQuery example);

  
    List<Arrange> selectByExample(ArrangeQuery example);

  
    @Select({
        "select",
        "id, course_id, class_id, room_id, techer_id, seme_id, course_name, class_name, ",
        "room_name, techer_name, star_week, end_week, srd, statu, mark",
        "from arrange",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("manong.mapper.ArrangeMapper.BaseResultMap")
    Arrange selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Arrange record, @Param("example") ArrangeQuery example);

    int updateByExample(@Param("record") Arrange record, @Param("example") ArrangeQuery example);

  
    int updateByPrimaryKeySelective(Arrange record);

  
    @Update({
        "update arrange",
        "set course_id = #{courseId,jdbcType=INTEGER},",
          "class_id = #{classId,jdbcType=INTEGER},",
          "room_id = #{roomId,jdbcType=INTEGER},",
          "techer_id = #{techerId,jdbcType=INTEGER},",
          "seme_id = #{semeId,jdbcType=INTEGER},",
          "course_name = #{courseName,jdbcType=VARCHAR},",
          "class_name = #{className,jdbcType=VARCHAR},",
          "room_name = #{roomName,jdbcType=VARCHAR},",
          "techer_name = #{techerName,jdbcType=VARCHAR},",
          "star_week = #{starWeek,jdbcType=INTEGER},",
          "end_week = #{endWeek,jdbcType=INTEGER},",
          "srd = #{srd,jdbcType=INTEGER},",
          "statu = #{statu,jdbcType=INTEGER},",
          "mark = #{mark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Arrange record);

   
    int insertOrUpdate(Arrange record);

  
    int insertOrUpdateSelective(Arrange record);

  
    int batchInsert(@Param("list") List<Arrange> list);

  
    int batchInsertSelective(@Param("list") List<Arrange> list, @Param("selective") Arrange.Column ... selective);
}